package com.warthur.jfinal.demo.validator;

import com.jfinal.core.Controller;
import com.jfinal.json.FastJson;
import com.jfinal.kit.Ret;
import com.warthur.jfinal.demo.pojo.param.UserBodyParam;

/**
 * @author warthur
 * @date 2019/10/08
 */
public class UserValidator extends BaseValidator<UserBodyParam> {

    @Override
    public UserBodyParam getObject() {
        return FastJson.getJson().parse(controller.getRawData(), UserBodyParam.class);
    }

    @Override
    protected void validate(Controller c) {
        validateRequiredString("userId", "userId非空");
        validateRequiredString("openId", "openId非空");
    }
}
